<?php
/**
 * @category 	Dao.php
 * @author 		Sung Hoon, Cho (akdddnet@gmail.com)
 * @since		2011. 1. 4.
 * @license		BSD License
 * @version		0.1
 */
 
global $CFG;
require_once $CFG->FW_DIR."/db.php";

class Dao {
 	protected $logger;
 	protected $db;
 	
 	function __construct(array $db_type = null) {
 		$this->logger = Logger::getInstance();
 		
	 	// db_type값이 전달이 되지 않는 경우에는 mysql 디비를 사용함.
	 	if(Common::isNullOrEmpty($db_type)) {
	 		global $CFG;
	 		$db_type = $CFG->mysql;
	 	}
 		
 		$this->db = new CF_db($db_type);
 	}
 	
 	
 	function beginTransaction() {
 		$this->db->begin();
 	}
 	
 	function commit() {
 		$this->db->commit();
 	}
 	
 	function rollback() {
 		$this->db->rollback();
 	}
 	
 	
 	function __destruct() {
 		if($this->db->isConnect()) {
 			$this->db->close();
 		}
 	}
 }